﻿<UserControl x:Class="PairingMatrix.View.DateStripControl"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:Interactivity="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity" xmlns:Behavior="clr-namespace:PairingMatrix.View.Behavior" xmlns:Converter="clr-namespace:PairingMatrix.View.Converter" mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400" 
    d:DataContext="{Binding Source={StaticResource DateStrip}}" 
    Width="700" Height="150" MaxWidth="700" MaxHeight="150" >

    <UserControl.Resources>
        <Converter:BoolToVisibilityConverter x:Key="boolToVisibilityConverter"/>
    </UserControl.Resources>

    <Grid x:Name="LayoutRoot" Width="700" Height="150" Visibility="{Binding Path=Show, Converter={StaticResource boolToVisibilityConverter}}">
        <Grid.OpacityMask>
                <LinearGradientBrush >
                    <GradientStop Color="Transparent" Offset="0"/>
                    <GradientStop Color="White" Offset="0.5"/>
                    <GradientStop Color="Transparent" Offset="1"/>
                </LinearGradientBrush>

        </Grid.OpacityMask>
        <Rectangle Width="100" Height="160" Stroke="Green" RadiusX="30" RadiusY="5" Margin="212,-5">
            <Rectangle.Fill>
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                    <GradientStop Color="#FF54920B" Offset="0.517"/>
                    <GradientStop Color="#FFFFFFFF"/>
                    <GradientStop Color="#FFFFFFFF" Offset="1"/>
                </LinearGradientBrush>
            </Rectangle.Fill>
        </Rectangle>

        <ItemsControl ItemsSource="{Binding Path=Dates}" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="-1216,0,0,0">
            <ItemsControl.ItemTemplate>
                <DataTemplate>
                    <Grid Background="Green" Height="40">
                        <Rectangle Width="100" Height="30" RadiusX="5" RadiusY="5" Stroke="#FFC7B8B8" Margin="1,0,0,0">
                            <Rectangle.Fill>
                                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                    <GradientStop Color="#FF54920B" Offset="1"/>
                                    <GradientStop Color="#FF75CB12"/>
                                </LinearGradientBrush>
                            </Rectangle.Fill>
                        </Rectangle>
                        <TextBlock Text="{Binding Path=DateDisplayText}" Margin="25,10,0,0" FontFamily="Century Gothic" FontSize="16" Foreground="White" FontWeight="Normal"/>
                    </Grid>
                </DataTemplate>
            </ItemsControl.ItemTemplate>
            <ItemsControl.ItemsPanel>
                <ItemsPanelTemplate>
                    <StackPanel Orientation="Horizontal" />
                </ItemsPanelTemplate>
            </ItemsControl.ItemsPanel>
            <ItemsControl.RenderTransform>
                <TranslateTransform x:Name="translateTransform"/>
            </ItemsControl.RenderTransform>
        </ItemsControl>
        
    </Grid>
    <Interactivity:Interaction.Behaviors>
        <Behavior:DragDateStripBehavior />
    </Interactivity:Interaction.Behaviors>
</UserControl>
